package com.coffee.order.api.sku.result;

import com.coffee.core.enums.SkuOrderStatusEnum;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
public class SkuOrderResultExport implements Serializable {
    private static final long serialVersionUID = -1L;
    private Integer skuOrderId;
    private String orderType;
    private String receiver;
    private String receiverMobile;
    private String address;
    private String skuName;
    private Double price;
    private Integer count;
    private String supplierName;
    private Double payPrice;
    private String status;
    private String statusStr;
    private String applyRefundStatus;
    private String deliveryWay;
    private Integer merchantId;
    private String merchantName;
    private String merchantMobile;
    private String placeMerchantMobile;
    private String placeMerchantName;
    private String postageStatus;
    private String isPay;
    private String productName;
    private String specifications;
    private String specificationsStr;
    private String unit;
    private Date createTime;
    private String merchantCity;

    public String getStatusStr() {
        if (SkuOrderStatusEnum.WAITING.getCode().equals(this.status)) {
            this.status = "等待支付";
        } else if (SkuOrderStatusEnum.WAITING.getCode().equals(this.status)) {
            this.status = "订单取消";
        } else if (SkuOrderStatusEnum.PAY.getCode().equals(this.status) && "N".equals(this.isPay)) {
            this.status = "已支付（待完成）";
        } else if (SkuOrderStatusEnum.PAY.getCode().equals(this.status) && "Y".equals(this.isPay)) {
            this.status = "已支付（已完成）";
        } else if (SkuOrderStatusEnum.SUCCESS.getCode().equals(this.status)) {
            this.status = "订单成功";
        } else if (SkuOrderStatusEnum.DELIVER.getCode().equals(this.status)) {
            this.status = "商品发货";
        }else if (SkuOrderStatusEnum.CANCEL.getCode().equals(this.status)) {
            this.status = "订单关闭";
        } else {
            this.status = this.status;
        }
        return status;
    }

    public String getSpecificationsStr() {
        return this.specifications + this.unit;
    }
}
